Added submatrices support for the SCE method #651
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Standardizes task vector extraction in SCE to use the same logic in get_task_vectors function from
generalized_task_arithmetic.py, adding submatrix support that was previously missing.Problem
SCE currently uses an independent implementation for extracting task vectors
This independent implementation lacks submatrix support
The
get_task_vectorsfunction ingeneralized_task_arithmetic.pyalready provides this functionalityCode duplication creates maintenance overhead and feature inconsistency, at some point SCE should benefit from the
generalized_task_arithmetic.pyimplementations.Solution
Added submatrix support for SCE such as in the existing
get_task_vectors functionEnsures consistent logic across both implementations
Adds submatrix support to SCE operations
Note
Adds submatrix handling and dtype normalization to
sce_merge, stacking only valid task vectors and warning when tensors are sliced.sce(mergekit/merge_methods/sce.py):base_tensorwhen shapes differ, with a warning per tensor.base_tensor.dtypebefore computing task vectors.sce_mask), sign-consensus erasing, weighting, and merge logic.Written by Cursor Bugbot for commit b318151. This will update automatically on new commits. Configure here.